﻿CREATE TABLE [dbo].[ConsultationBill] (
    [Id]                   INT             IDENTITY (1, 1) NOT NULL,
    [ConsultationId]       INT             NOT NULL,
    [BillNo]               NVARCHAR (50)   NULL,
    [OpenId]               NVARCHAR (50)   CONSTRAINT [DF__Consultat__BillC__00DF2177] DEFAULT ((1)) NULL,
    [BillStatus]           INT             NULL,
    [WxTransactionId]      NVARCHAR (50)   NOT NULL,
    [WxRefundId]           NVARCHAR (50)   NULL,
    [PayTime]              DATETIME        NULL,
    [RefundReason]         NVARCHAR (50)   NULL,
    [RefundTime]           DATETIME        NULL,
    [TotalMoney]           DECIMAL (18, 2) NULL,
    [CreateDatetime]       DATETIME        NULL,
    [NextCheckTime]        DATETIME        NULL,
    [BillStatusOnSetCheck] INT             NULL,
    [CheckReserved]        NVARCHAR (50)   NULL,
    CONSTRAINT [PK__Consulta__3214EC077E02B4CC] PRIMARY KEY CLUSTERED ([Id] ASC)
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'主键', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ConsultationBill', @level2type = N'COLUMN', @level2name = N'Id';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'会话ID', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ConsultationBill', @level2type = N'COLUMN', @level2name = N'ConsultationId';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'账单编号', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ConsultationBill', @level2type = N'COLUMN', @level2name = N'BillNo';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'咨询次数', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ConsultationBill', @level2type = N'COLUMN', @level2name = N'OpenId';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'账单状态0-未支付 1-支付中 2-支付成功 3-支付失败4-退款中5-退款成功6-退款失败7-已结束', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ConsultationBill', @level2type = N'COLUMN', @level2name = N'BillStatus';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'微信支付交易号', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ConsultationBill', @level2type = N'COLUMN', @level2name = N'WxTransactionId';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'微信退款交易号', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ConsultationBill', @level2type = N'COLUMN', @level2name = N'WxRefundId';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'支付时间', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ConsultationBill', @level2type = N'COLUMN', @level2name = N'PayTime';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'退款时间', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ConsultationBill', @level2type = N'COLUMN', @level2name = N'RefundTime';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'总金额', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ConsultationBill', @level2type = N'COLUMN', @level2name = N'TotalMoney';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'创建时间', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ConsultationBill', @level2type = N'COLUMN', @level2name = N'CreateDatetime';

